package com.company.loganalyzer.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 工具执行结果DTO
 */
@Builder
@Data
@AllArgsConstructor
public class ToolResult {
    private String toolName;
    private String status;
    private Object data;
    private String message;
    private long executionTime;
    private LocalDateTime timestamp;
    private Map<String, Object> metadata;
    
    // 构造函数
    public ToolResult() {}
    
    public ToolResult(String toolName, String status, Object data, String message) {
        this.toolName = toolName;
        this.status = status;
        this.data = data;
        this.message = message;
        this.timestamp = LocalDateTime.now();
    }
    
    // 静态工厂方法
    public static ToolResult success(String toolName, Object data) {
        return new ToolResult(toolName, "success", data, "执行成功");
    }
    
    public static ToolResult error(String toolName, String message) {
        return new ToolResult(toolName, "error", null, message);
    }
    
    // Getters and Setters
    public String getToolName() { return toolName; }
    public void setToolName(String toolName) { this.toolName = toolName; }
    
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    
    public Object getData() { return data; }
    public void setData(Object data) { this.data = data; }
    
    public String getMessage() { return message; }
    public void setMessage(String message) { this.message = message; }
    
    public long getExecutionTime() { return executionTime; }
    public void setExecutionTime(long executionTime) { this.executionTime = executionTime; }
    
    public LocalDateTime getTimestamp() { return timestamp; }
    public void setTimestamp(LocalDateTime timestamp) { this.timestamp = timestamp; }
    
    public Map<String, Object> getMetadata() { return metadata; }
    public void setMetadata(Map<String, Object> metadata) { this.metadata = metadata; }
}